<div class="toolbar">
  <div class="toolbar-header">
    <%= "ID: #{@drug.code} - #{@drug.name}" %>
  </div>
</div>

<ul class="nav nav-tabs">
  <li class="active"><a href="#detail" data-toggle="tab"><%= t :drug_information %></a></li>
  <li><a href="#manufacturers" data-toggle="tab"><%= t :manufacturers %></a></li>
  <li><a href="#suppliers" data-toggle="tab"><%= t :suppliers %></a></li>
  <li><a href="#stocks" data-toggle="tab"><%= t :stocks %></a></li>
  <li><a href="#transactions" data-toggle="tab"><%= t :log_transactions %></a></li>
  <li><a href="#prescriptions" data-toggle="tab"><%= t :log_prescriptions %></a></li>
</ul>

<!-- Tab panes -->
<div class="tab-content">
  <div class="tab-pane active" id="detail">
    <div class="row toolbar">
	  <div class="col-md-6">
		<span class="toolbar-header">
		  <%= t :drug_information %>
		</span>
	  </div>
	  <div class="col-md-6 text-right">
		<ul class="toolbar-nav">
		  <li><%= link_to feather_icon('circle-plus'), new_drug_path %></li>
		  <li><%= link_to simple_icon('note'), edit_drug_path(@drug) %></li> 
		  <li><%= link_to feather_icon('trash'), Drug, method: :delete, data: { confirm: 'Are you sure?' } %></li>
		</ul>
	  </div>
	</div>
	<table class="table table-striped">
      <tbody>
        <tr>
          <td><strong><%= t :code %></strong></td>
          <td><%= @drug.code %></td>
        </tr>
        <tr>
          <td><strong><%= t :name %></strong></td>
          <td><%= @drug.name %></td>
        </tr>
        <tr>
          <td><strong><%= t :price_per_item %></strong></td>
          <td><%= @drug.price_per_item %></td>
        </tr>
        <tr>
          <td><strong><%= t :decriptions %></strong></td>
          <td><%= @drug.description %></td>
        </tr>
      </tbody>
    </table>
  </div>
  
  <div class="tab-pane" id="manufacturers">
    <div class="row toolbar">
	  <div class="col-md-6">
		<span class="toolbar-header">
		  <%= t :manufacturers %>
		</span>
	  </div>
	  <div class="col-md-6 text-right">
		<ul class="toolbar-nav">
		  <li><%= link_to feather_icon('circle-plus'), new_drug_manufacturer_path(:drug_id => params[:id]) %></li>
		  <li><% link_to simple_icon('note'), edit_drug_path(@drug) %></li> 
		  <li><% link_to feather_icon('trash'), Drug, method: :delete, data: { confirm: 'Are you sure?' } %></li>
		</ul>
	  </div>
	</div>
	<table class="table table-striped">
      <thead>
			<tr>
			  <th><%= t :actions %></th>
			  <th><%= t :name %></th>
			  <th><%= t :code %></th>
			  <th>Website</th>
			  <th><%= t :address %></th>
			  <th>Email</th>
			  <th><%= t :phone %></th>
			  <th>Fax</th>
			</tr>
		</thead>
		
		<tbody>
        <tr>
			<%= render @drug.manufacturers %>
        </tr>
      </tbody>
    </table>
  </div>
  
  <div class="tab-pane" id="suppliers">
    <div class="row toolbar">
	  <div class="col-md-6">
		<span class="toolbar-header">
		  Suppliers
		</span>
	  </div>
	  <div class="col-md-6 text-right">
		<ul class="toolbar-nav">
		  <li><%= link_to feather_icon('circle-plus'), new_drug_supplier_path(:drug_id => params[:id]) %></li>
		  <li><% link_to simple_icon('note'), edit_drug_path(@drug) %></li> 
		  <li><% link_to feather_icon('trash'), Drug, method: :delete, data: { confirm: 'Are you sure?' } %></li>
		</ul>
	  </div>
	</div>
	<table class="table table-striped">
      <thead>
			<tr>
			  <th><%= t :actions %></th>
			  <th><%= t :name %></th>
			  <th><%= t :code %></th>
			  <th>Website</th>
			  <th><%= t :address %></th>
			  <th>Email</th>
			  <th><%= t :phone %></th>
			  <th>Fax</th>
			</tr>
		</thead>
		
		<tbody>
        <tr>
          <%= render @drug.suppliers %>
        </tr>
      </tbody>
    </table>
  </div>
  
  <div class="tab-pane" id="stocks">
    <div class="row toolbar">
	  <div class="col-md-6">
		<span class="toolbar-header">
		  Stocks
		</span>
	  </div>
	  <div class="col-md-6 text-right">
		<ul class="toolbar-nav">
		  <li><%= link_to feather_icon('circle-plus'), new_drug_stock_logging_path(:drug_id => params[:id]) %></li>
		  <li><% link_to simple_icon('note'), edit_drug_path(@drug) %></li> 
		  <li><% link_to feather_icon('trash'), Drug, method: :delete, data: { confirm: 'Are you sure?' } %></li>
		</ul>
	  </div>
	</div>
	<table class="table table-striped">
		<thead>
		<tr>
		  <th><%= t :stock_id %></th>
		  <th><%= t :iventory_in %></th>
		  <th><%= t :quantities %></th>
		  <th colspan="2"></th>
		</tr>
		</thead>
	
		<tbody>
			<%= render @drug.stocks %>
		</tbody>
    </table>
    </br><b>Total <%= t :stock_in_inventory %>: <%= @total_stocks %> </b>
  </div>
  
  <div class="tab-pane" id="transactions">
    <div class="row toolbar">
	  <div class="col-md-6">
		<span class="toolbar-header">
		  <%= t :log_transactions %>
		</span>
	  </div>
	  <div class="col-md-6 text-right">
		<ul class="toolbar-nav">
		  <li><%= link_to feather_icon('circle-plus'), new_drug_stock_logging_path(:drug_id => params[:id]) %></li>
		  <li><% link_to simple_icon('note'), edit_drug_path(@drug) %></li> 
		  <li><% link_to feather_icon('trash'), Drug, method: :delete, data: { confirm: 'Are you sure?' } %></li>
		</ul>
	  </div>
	</div>
	<table class="table table-striped">
      <thead>
		<tr>
		  <th><%= t :actions %></th>
		  <th><%= t :date_translate %></th>
		  <th><%= t :transaction_type %></th>
		  <th><%= t :inventory_at %></th>
		  <th><%= t :quantities %></th>
		</tr>
		</thead>
		
		<tbody>
			<%= render @drug.stock_loggings %>
		</tbody>
    </table>
    </br><b>Total <%= t :stock_in_transaction %>: <%= @total_transactions %></b>
  </div>
  
  <div class="tab-pane" id="prescriptions">
    <div class="row toolbar">
	  <div class="col-md-6">
		<span class="toolbar-header">
		  <%= t :log_prescriptions %>
		</span>
	  </div>
	  <div class="col-md-6 text-right">
		<ul class="toolbar-nav">
		  <li><% link_to feather_icon('circle-plus'), new_prescription_path %></li>
		  <li><% link_to simple_icon('note'), edit_drug_path(@drug) %></li> 
		  <li><% link_to feather_icon('trash'), Drug, method: :delete, data: { confirm: 'Are you sure?' } %></li>
		</ul>
	  </div>
	</div>
	<table class="table table-striped">
		<thead>
			<tr>
			  <th><%= t :actions %></th>
			  <th><%= t :prescription_id %></th>
			  <th><%= t :patients %></th>
			  <th><%= t :dosage %></th>
			  <th><%= t :quantities %></th>
			  <th><%= t :fee %></th>
			  <th><%= t :note %></th>
			</tr>
		</thead>
		
		<tbody>
			<%= render @drug.prescriptions %>
		</tbody>
    </table>
    </br><b>Total <%= t :quantities %>: <%= @total_prescriptions %></b>
  </div>
  
</div>

